<html>
<script type="text/javascript">
<!--
function sendit()
	{
	valid=true;
	if(document.email.to.value=="")
		{
		alert("You must specify a person to send this email to!");
		valid=false;
		}
	if(document.email.from.value=="")
		{
		alert("You must specify an account to send this email from!");
		valid=false;
		}
	if(document.email.subject.value=="")
		{
		alert("You are not allowed to send emails without subjects from this page.");
		valid=false;
		}
	if(document.email.message.value=="")
		{
		alert("You are not allowed to send emails without a message from this page.");
		valid=false;
		}
	/* document.write(document.email.to.value); */
	return valid;
}
//-->
</script>
<body>
<?php
if(isset($_POST['to']))
	{
// Set up parameters
	$to=$_POST['to'];
	$subject=$_POST['subject'];
	$from=$_POST['from'];
	$message=" ?>
	<html>
		<body>
		<?php ";
	$message="<p>Hello Homer,</p>
	<p>Thanks for registering.</p>
	<p>Your password is: <b>springfield</b></p>
	";
	if($_POST['receipt']=='1')
		{
		$message.=" ?><img src="http://site.groupmsl.co.uk/gmslfilemanager/files/receipt.php?to=recipient1&subject=hello&from=me"/><?php ";
		}
	$headers="MIME-Version: 1.0" . "\n";
	$headers.="Content-type:text/html;charset=iso-8859-1" . "\n";
	$headers.="From: $from" . "\n";
// Send email
	mail($to,$subject,$message,$headers);

// Inform the user
?>
	<script type="text/javascript">
	<!--
	document.write("Thanks for registering! We have just sent you an email with your password.");
	//-->
	</script>
	<?php
	}
else
	{
?>
	<p class="normaltext">Email Sender...</p>
	<p class="normaltext">
<form name="email" onsubmit="return sendit( );" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
    <p>To: <input type="text" name="to" value="groupmsl@gmail.com" size="25" /></p>
    <p>From: <select name="from">
    <option value="groupmsl@gmail.com" selected="selected">groupmsl@gmail.com</option>
    <option value="me@groupmsl.co.uk">me@groupmsl.co.uk</option>
    <option value="andrew@gropmsl.co.uk">andrew@gropmsl.co.uk</option>
    </select></p>
    <p>Subject: <input type="text" name="subject" value="Hello!!!" size="25" /></p>
    <p>Message:</p>
    <p><textarea name="message" cols="100" rows="20"></textarea></p>
    <p>Signature: Not yet implemented</p>
    <p>Send reciept on read: <input type="checkbox" name="receipt" value="1" checked="checked" /> (Not supported by everyones email client)</p>
    <p><input type="submit" name="send" value="Send" /> <input type="reset" name="reset" value="Clear Page" /></p>
</form>
</p>
<?php
	}
?>
</body>
</html>
